package cn.zz.veggie.application.packer;

import cn.zz.veggie.model.domain.Product;
import cn.zz.veggie.web.types.vo.his.HisProductVo;
import cn.zz.veggie.web.types.vo.mgmt.MgmtProductVo;

/**
 * @author zhongq
 * @since 2024/4/4
 */
public class ProductPacker {
	public static MgmtProductVo packMgmtVo(Product product) {
		final MgmtProductVo vo = new MgmtProductVo();
		vo.setId(product.getId());
		vo.setName(product.getName());
		vo.setImage(product.getImage());
		vo.setPrice(product.getPrice());
		vo.setUnit(product.getUnit());
		vo.setSpec(product.getSpec());
		vo.setStatus(product.getStatus());
		return vo;
	}

	public static HisProductVo toHisProductVo(Product product) {
		HisProductVo vo = new HisProductVo();
		vo.setId(product.getId());
		vo.setName(product.getName());
		vo.setImage(product.getImage());
		vo.setPrice(product.getPrice());
		vo.setUnit(product.getUnit());
		vo.setSpec(product.getSpec());
		return vo;
	}

	public static void injectHisProductVo(HisProductVo vo, Product product) {
		vo.setId(product.getId());
		vo.setName(product.getName());
		vo.setImage(product.getImage());
		vo.setPrice(product.getPrice());
		vo.setUnit(product.getUnit());
		vo.setSpec(product.getSpec());
	}
}